//package com.hexiang.config;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//import org.springframework.http.client.ClientHttpRequestFactory;
//import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
//import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
//import org.springframework.http.client.SimpleClientHttpRequestFactory;
//import org.springframework.web.client.RestTemplate;
//
//@Configuration
//public class RestTemplateConfig {
//    @Bean
//    public RestTemplate restTemplate(ClientHttpRequestFactory factory) {
//        return new RestTemplate(factory);
//    }
//
//
//    @Bean
//    public ClientHttpRequestFactory simpleClientHttpRequestFactory() {
//        SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
//        //单位为ms
//        factory.setReadTimeout(5000);
//        //单位为ms
//        factory.setConnectTimeout(5000);
//        return factory;
//    }
//
//    @Primary
//    @Bean
//    public ClientHttpRequestFactory httpComponentsClientHttpRequestFactory() {
//        HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory();
//        //单位为ms
//        factory.setReadTimeout(6000);
//        //单位为ms
//        factory.setConnectTimeout(6000);
//        return factory;
//    }
//
//    @Bean
//    public ClientHttpRequestFactory okHttp3ClientHttpRequestFactory() {
//        OkHttp3ClientHttpRequestFactory factory = new OkHttp3ClientHttpRequestFactory();
//        //单位为ms
//        factory.setReadTimeout(7000);
//        //单位为ms
//        factory.setConnectTimeout(7000);
//        return factory;
//    }
//
//}